<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录页面</title>
    <link rel="stylesheet" href="/static/css/element-ui/element-ui.css">
    <link rel="stylesheet" href="/static/css/public.css">
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/layer/layer.js"></script>
    <script src="/static/js/vue.min.js"></script>
    <script src="/static/js/element-ui.js"></script>
    <script src="/static/js/public.js"></script>
</head>
<body>
<div v-cloak id="app" class="w-50 content-center pt-20">
    <el-input
            placeholder="请输入内容"
            prefix-icon="el-icon-user-solid"
            v-model="username">
    </el-input>
    <el-input class="mt-15" type="password"
              placeholder="请输入内容"
              prefix-icon="el-icon-key"
              v-model="password">
    </el-input>
    <div class="mt-15 text-right">
        <el-button type="primary" :loading="isLoading" @click="validatePrincipal">登录</el-button>
    </div>
</div>
<script>
    if (window != top) {
        top.location.href = location.href;
    }

    $(function () {
    });
    var data = {
        username: "myjoje",
        password: "123",
        isLoading: false
    };

    var methods = {
        validatePrincipal: function () {
            data.isLoading = true;
            ajax.post("/pub/validatePrincipal", {
                username: data.username,
                password: data.password
            }, function (res) {
                data.isLoading = false;
                if (res.code == 1) {
                    window.location.href = "/home/home_index";
                } else {
                    layer.alert(res.msg);
                }
            })
        }
    };
    var vm = new Vue({data: data, methods: methods}).$mount("#app");
</script>
</body>
</html>
